package com.supor.aiot.mine.api;

import com.android.baseconfig.base.BaseApiResult;
import com.android.baseconfig.base.BaseRetrofit;
import com.android.baseconfig.base.DataApiResult;
import com.supor.aiot.mine.bean.CookingEvalDetail;
import com.supor.aiot.mine.bean.CookingRecordBean;
import com.supor.aiot.mine.bean.CookingRecordNumBean;
import com.supor.aiot.mine.bean.RecipeEvalBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.RequestBody;

/**
 * @author: zook
 * @date: 2021/10/15
 */
public class CookingRecordImpl extends BaseRetrofit<CookingRecordSetvice> implements CookingRecordSetvice {
    private static CookingRecordImpl instance;

    public static CookingRecordImpl getInstance() {
        if (instance == null) {
            instance = new CookingRecordImpl();
        }
        return instance;
    }

    @Override
    public Observable<BaseApiResult<CookingRecordNumBean>> getCookingNum() {
        return api.getCookingNum().compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<CookingRecordBean>>>> getCookingRecordList(int isEval, int page, int limit) {
        return api.getCookingRecordList(isEval, page, limit).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<CookingRecordBean>>>> getCookingRecordListWithMacArr(int isEval, String productModel, int page, int limit) {
        return api.getCookingRecordListWithMacArr(isEval, productModel, page, limit).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<CookingRecordBean>>>> getCookingRecordList(int page, int limit) {
        return api.getCookingRecordList(page, limit).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<CookingRecordBean>>>> getCookingRecordListWithMacArr(String productModel, int page, int limit) {
        return api.getCookingRecordListWithMacArr(productModel, page, limit).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<CookingEvalDetail>> getCookingEvalDetail(String logId) {
        return api.getCookingEvalDetail(logId).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<RecipeEvalBean>> submitEval(RequestBody requestBody) {
        return api.submitEval(requestBody).compose(this.applySchedulers());
    }
}
